package tests.第三方工具类测试使用.mapstruct.pojo;

/**
 * @author: SunAo
 * @create: 2020-08-26 11:15
 */
public enum SexEnum {
    MAN(1,"男性"),
    WOMAN(2,"女性"),
    THIRD(3,"中性");

    private Integer code;
    private String name;

    SexEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static SexEnum parse(Integer code){
        for (SexEnum value : SexEnum.values()) {
            if(value.getCode().equals(code)) return value;
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
